Class Global


  • public final class Global
    extends java.lang.Object
    Holds "Global" data that needs to be accessed by multiple parts of the program. Should a piece of data, like the LogUtil reference or the output directory, need to be shared by multiple parts of the program it will be stored here. This is a static class and requires no instantiation.
    Version:
    3.1 May 28, 2015
    Author:
    Charles Allen Schultz II
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static LogUtil logger
      The LogUtil reference used for logging data in the program.
      private static java.io.File output
      The output directory for storing results.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Global()
      Private constructor for preventing instantiation of the class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void destroyLogger()
      Destroys the LogUtil reference.
      static LogUtil getLogger()
      Gets the logger.
      static java.io.File getOutput()
      Gets the output directory for storing results.
      static void makeLogger​(LogLevel maxGranularity, boolean[] fileLogs, boolean[] terminalLogs)
      Instantiates the logger field.
      static boolean setOutput​(java.io.File file)
      Sets the output directory for storing results.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        private static LogUtil logger
        The LogUtil reference used for logging data in the program.
      • output

        private static java.io.File output
        The output directory for storing results. Defaults to the working directory.
    • Constructor Detail

      • Global

        private Global()
        Private constructor for preventing instantiation of the class.
    • Method Detail

      • makeLogger

        public static void makeLogger​(LogLevel maxGranularity,
                                      boolean[] fileLogs,
                                      boolean[] terminalLogs)
        Instantiates the logger field.
        Parameters:
        maxGranularity - the maximum granularity of the log messages.
        fileLogs - the boolean array indicating file log settings.
        terminalLogs - the boolean array indicating terminal output settings.
      • destroyLogger

        public static void destroyLogger()
        Destroys the LogUtil reference. Calls the destroy() method on the logger field if the logger field is not null.
      • getLogger

        public static LogUtil getLogger()
        Gets the logger.
        Returns:
        the LogUtil reference used for logging in the program.
      • setOutput

        public static boolean setOutput​(java.io.File file)
        Sets the output directory for storing results.
        Parameters:
        file - the File representing the new output directory.
        Returns:
        a boolean indicating if the output directory was successfully set.
      • getOutput

        public static java.io.File getOutput()
        Gets the output directory for storing results.
        Returns:
        the File representing the output directory.